<?php

class Admin_Form_SendMsg extends Zend_Form {
	const TITEL_LABEL     ='Tiêu đề';
	const CONTENT_LABEL   ='Nội dung';
	const ENCODING        ='UTF-8';



	public function init() {

		//$this->setName('message');
		$this->setAttrib('id', 'sendmsg');
		$this->setAction('/admin/message/send')
		->setMethod('post');
		
		//Not empty validate
		$notEmpty = new Zend_Validate_NotEmpty();
		$title = new Zend_Form_Element_Textarea("tieu_de");
		$title	->setLabel(self::TITEL_LABEL)
		->addFilter('StringTrim')
		->setAttrib ( 'placeholder', 'Nhập tiêu đề tin nhắn' )
		->setOptions(array('cols' => '8', 'rows' => '2','value'=>null,'class'=>'span4'))
		->setRequired(true)
		->addValidator($notEmpty,true);
		//Content
		$content = new Zend_Form_Element_Textarea("noi_dung");
		$content	->setLabel(self::CONTENT_LABEL)
		->setAttrib ( 'placeholder', 'Nhập nội dung tin nhắn' )
		->addFilter('StringTrim')
		->setOptions(array('cols' => '8', 'rows' => '4','value'=>null,'class'=>'span4'))
		->setRequired(true)
		->addValidator($notEmpty,true);
		//Button
		$submit = new Zend_Form_Element_Button('submit');
		$submit->setLabel("Send")
		->setAttrib('id', 'submitbutton')
		->setAttrib("class", "btn btn-large btn-primary ")
		->removeDecorator('DtDdWrapper');
		$reset = new Zend_Form_Element_Reset('reset');
		$reset->setLabel("Reset")
		->setAttrib('id', 'resetbutton')
		->setAttrib("class", "btn btn-large")
		->removeDecorator('DtDdWrapper');
		$this->addElements(array($title,$content,$submit,$reset));
		$this->addDisplayGroup(array('submit', 'reset'), 'buttons');
		$dg = $this->getDisplayGroup('buttons');
		$dg->removeDecorator('Fieldset');
		$dg->removeDecorator('HtmlTag');
	}
	public function addHid($field, $value){
		$hiddenIdField = new Zend_Form_Element_Hidden($field);
		$hiddenIdField->setValue($value)
		->removeDecorator('label')
		->removeDecorator('HtmlTag');
		$this->addElement($hiddenIdField);
	}
}
